/**
 * Check the numberic number.
 * @param ctrl The control.
 */
function ev_checkNumeric(ctrl){
  if (ctrl!=null && ctrl.value !=''){
	  if (!validatenumeric(ctrl.value)) {
		alert('You should input the numberic value here.');
		ctrl.focus();
	  }
  }
}
/**
 * Check the date.
 * @param ctrl The control.
 */
function ev_checkDate(ctrl){
  if (ctrl!=null && ctrl.value !=''){
	  if (!validatedate(ctrl.value)) {
		alert('You should input the date value here.');
		ctrl.focus();
	  }
  }
}
/**
 * validate the numeric value;
 * @param ctrl The value.
 * @return right or not.
 */
function validatenumeric(str){
	return !isNaN(str);
}
/**
 * validate the date value;
 * @param ctrl The value.
 * @return right or not.
 */
function validatedate(str){
	return (validatedate2(str) == 1);
}
/**
 * validate the date value;
 * @param ctrl The value.
 * @return 1 for right,else for wrong.
 */
function validatedate2(str)
{
  /*
  str must be as:  yyyy/mm/dd or yyyy-mm-dd or yyyy.mm.dd
  */
  var objRegExp = /^\d{4}(\-|\/|\.)\d{1,2}(\-|\/|\.)\d{1,2}$/;
  if(!objRegExp.test(str))
  {
    return 11;
  }
  else{
    var strSeparator = str.substring(4,5);
    var arrayDate = str.split(strSeparator); //split date into month, day, year
    //create a lookup for months not equal to Feb.
    var arrayLookup = { '01' : 31,'03' : 31, '04' : 30,'05' : 31,'06' : 30,'07' : 31,
        '08' : 31,'09' : 30,'10' : 31,'11' : 30,'12' : 31};
    var intDay = eval(arrayDate[2]);
    var intMonth = eval(arrayDate[1]);
    if(intMonth > 12 || intMonth <= 0) return 12;
    if(arrayDate[1].length < 2) arrayDate[1] = '0' + arrayDate[1];

    //check if month value and day value agree
    if(arrayLookup[arrayDate[1]] != null ) {
      if(intDay <= arrayLookup[arrayDate[1]] && intDay != 0)
        return 1; //found in lookup table, good date
    }
    //check for February
    if(intMonth == 2)
    {
      var intYear = parseInt(arrayDate[0]);
      if( ((intYear % 4 == 0 && intDay <= 29) || (intYear % 4 != 0 && intDay <=28)) && intDay !=0)
        return 1;
    }

  }
  return 11;
}